# Contributor: Jean-Louis Fuchs <jean-louis.fuchs@adfinis-sygroup.ch>
# Maintainer: Jean-Louis Fuchs <jean-louis.fuchs@adfinis-sygroup.ch>
pkgname=vice
pkgver=3.8
pkgrel=0
pkgdesc="emulates the C64/DTV, C128, VIC20, almost all PETs, PLUS4 and CBM-II"
url="https://vice-emu.sourceforge.net/"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	alsa-lib-dev
	autoconf
	automake
	bash
	bdftopcf
	bison
	curl-dev
	ffmpeg4-dev
	flex
	giflib-dev
	glew-dev
	gtk+3.0-dev
	jpeg-dev
	libpng-dev
	linux-headers
	texinfo
	xa
	"
source="https://downloads.sourceforge.net/vice-emu/vice-$pkgver.tar.gz
	disable-fc-cache.patch
	"

# Starting with version 3.8, only PDF docs are installed to
# /usr/share/doc/vice, texlive is required to generate that
case "$CARCH" in
ppc64le|s390x|riscv64)
	;;
*)
	makedepends="$makedepends texlive"
	subpackages="$subpackages $pkgname-doc"
	_extra_opts="--enable-pdf-docs"
	;;
esac

prepare() {
	default_prepare
	autoreconf -fi
}

build() {
	./configure --prefix=/usr \
		--libdir=/usr/lib \
		--enable-native-gtk3ui \
		--enable-x64 \
		--disable-no-pic \
		--without-pulse \
		--enable-external-ffmpeg \
		$_extra_opts
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

check() {
	make -C "$builddir" check
}

sha512sums="
fe644667736c32386b62af53314a95bf510c75d476eaab14b4c37693f2f57d6815126ab3db2f0cb11300c1a4a07c29b3f25210800ce97a673a0460ab59d0ebba  vice-3.8.tar.gz
ed6fee34eefcb04c42b4575591dfeffca8548eae354dee66dabdbc4abac0311cbbedcdc07cdfcb01da4840d57ab331a31583e17160820462a2c064835a75d75d  disable-fc-cache.patch
"
